class Solution {
public:
    bool detectCapitalUse(string word) {
        int judge=0;
        for(auto i : word){
            judge+= (tolower(i)-i);
        }
        if(judge==word.size()*('a'-'A'))return true;
        if(judge==0)return true;
        if(judge=='a'-'A' && word[0]<'a')return true;
        return false;

    }
};
